package com.qi.spzx.manager.mapper;

import com.qi.spzx.model.entity.system.SysRoleUser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

/**
 * @Description TODO
 * @Author dingchunlin
 * @Date 2024/2/22 14:33
 * @Version 1.0.0
 */
@Mapper
public interface SysRoleUserMapper {

    @Select("select role_id from sys_user_role where user_id = #{userId} and is_deleted = 1")
    List<Long> findSysUserRoleByUserId(Long userId);

    @Delete("delete from sys_user_role where user_id = #{userId}")
    void deleteByUserId(Long userId);

    @Insert("insert into sys_user_role value(null,#{roleId},#{userId},now(),now(),1)")
    void add(SysRoleUser sysRoleUser);
}
